<template>
  <div class="main">
    <div class="content">
      <view class="div_title">
        <text class="title">意见反馈</text>
        <text class="char_num">0字</text>
      </view>
      <view class="text_area">
        <textarea  class="input_content" maxlength="400" v-model="content"  placeholder="请输入您的意见和建议"/>
      </view>
    </div>

    <text :class="canRegister ? 'btnCanLogin' : 'btnlogin'" :disabled="!canRegister" @click="toCommit">提交</text>
  </div>
</template>

<script>
import store from '@/store/store'
import api from '@/utils/api'
export default {
  computed: {
    userInfo () {
      return store.state.userInfo
    }
  },
  data () {
    return {
      logs: [],
      canRegister: true,
      content: ''
    }
  },
  methods: {
    toCommit () {
      const opsettingfeedback = api.opsettingfeedback(this.content, this.userInfo.cellphone)
      opsettingfeedback.then(d => {
        if (d.code === 200) {
          wx.showToast({
            title: '提交成功',
            icon: 'success'
          })
          setTimeout(function () {
            wx.navigateBack()
          }, 1000)
        }
      })
      .catch((e) => {
        console.log(e)
      })
    }
  }
}
</script>

<style>
@import './feedback.css';
</style>
